package pong;

import java.awt.Point;
import java.io.Serializable;

enum Sender {Ball,paddle1,Paddle2}
public class Communication implements Serializable
{
    public final Point location;
    private final Sender sender;
       public Communication(Point location, Sender sender)
        {
            this.location = location;
            this.sender = sender;
        }
        
        Point getLocation()
        {
            return new Point(location);
        }
        
        Sender getSender()
        {
            return sender;
        }
        
    @Override
        public boolean equals(Object o)
        {
            if(o instanceof Communication)
            {
                Communication c = (Communication) o;
                if(c.sender == this.sender && c.location == this.location)
                {
                    return true;
                }
            }
            return false;             
        }
    
    @Override
    public String toString()
    {
     return   location.toString()+ "," + sender.toString();
    }     
}
